package edu.neumont.pro180._2009_q2;
import java.util.Scanner;

import edu.neumont.pro180._2009_q2.chess.ChessGame;



public class ConsoleDriver {

	/**
	 * Main method that runs the game program.
	 * @param args Total number of rows / columns / checkers to set up the board.
	 */
	private static int boardSize = 8;
	public static void main(String[] args) {
//		BoardGame game = new BoardGame();
		BoardGame game = new ChessGame();
		if (args.length == 3) {
//			game.rowCount = Integer.parseInt(args[0]);
//			game.columnCount = Integer.parseInt(args[1]);
			game.rowCount = boardSize;
			game.columnCount = boardSize;
			game.checkerCount = Integer.parseInt(args[2]);
		}
		while (!game.validateSettings()) {
			// Tell the user to input
			ConsoleDriver.getSetupInput(game);
		}
		game.playGame();
	}
	
	/**
	 * Gets input from the console to populate the BoardGame.
	 * @param The BoardGame that will be populated from the user's input.
	 */
	public static void getSetupInput(BoardGame game) {
		Scanner scanner = new Scanner(System.in);
//		System.out.println("How many rows? Enter a number larger than 0.");
//		int rowCount = scanner.nextInt();
//		System.out.println("How many columns? Enter a number larger than 0.");
//		int columnCount = scanner.nextInt();
		int rowCount = boardSize;
		int columnCount = boardSize;
		
		System.out.println("How many pieces? Enter a number between 1 and "
//				+ ((columnCount * rowCount) / 2 - 1));
				+ ((columnCount * rowCount) - 1));
		int checkerCount = scanner.nextInt();
		
//		game.rowCount = rowCount;
//		game.columnCount = columnCount;
		game.rowCount = boardSize;
		game.columnCount = boardSize;
		game.checkerCount = checkerCount;
	}

}
